package smartcommunityserver.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import smartcommunityserver.bean.BaseCountBean;

import java.util.List;
@Mapper
public interface BaseCountMapper {
    @Select("SELECT '小区' as              name,\n" +
            "       COUNT(communityName) count\n" +
            "FROM (SELECT communityName\n" +
            "      FROM sca_doris_export.dws_owner_behavior\n" +
            "      GROUP BY communityName) a1\n" +
            "UNION all\n" +
            "SELECT '业主',\n" +
            "       COunt(ownerId) as owner_count\n" +
            "FROM (SELECT ownerId\n" +
            "      FROM sca_doris_export.dws_owner_behavior\n" +
            "      GROUP BY ownerId) a2\n" +
            "UNION all\n" +
            "SELECT '车辆',\n" +
            "       COunt(carCode) as carCode_count\n" +
            "FROM (SELECT carCode\n" +
            "      FROM sca_doris_export.dws_car_behavior\n" +
            "      GROUP BY carCode) a2")
    List<BaseCountBean> baseCountMapper();
}
